import { defineConfig } from 'vite'
import uni from "@dcloudio/vite-plugin-uni";

const path = require('path')
function resolve(dir) {
  //__dirname 变量 是以文件所处的路径为值
  return path.join(__dirname, dir)
}

export default defineConfig(({ command, mode }) => {
  return {
    base: "./",
    plugins: [uni()],
    resolve: {
      alias: {
        '@': resolve('src'),
        'assets': resolve('src/assets'),
        'components': resolve('src/components'),
        'public': resolve('public')
      }
    },
    server: {
      port: 3000,
      open: true,
      watch: {
        ignored: ['node_modules'],
      },
      proxy: {
        ["/sjsj-ht"]: {
          ws: true,
          target: "https://trimdata.cn:2000",
          // target: "http://i.trimdata.cn:8162",
          changeOrigin: true,
        }
      }
    }
  }
})
